kernel: pcs-mtk-lynxi: backport fix for in-band status capabilities
authorHauke Mehrtens <hauke@hauke-m.de>
Thu, 1 Jan 2026 16:38:07 +0000 (17:38 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 4 Jan 2026 15:41:29 +0000 (16:41 +0100)
This patch fixes a bug in a patch we backported.

This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.

Fixes: 813ecda1f387 ("generic: backport phylink patches for PCS/PHY caps OPs")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/generic/backport-6.12/603-v6.14-net-pcs-pcs-mtk-lynxi-correctly-report-in-band-statu.patch [new file with mode: 0644]
target/linux/generic/hack-6.12/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch
target/linux/generic/pending-6.12/739-03-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch
target/linux/mediatek/patches-6.12/740-net-pcs-mtk_lynxi-add-mt7987-support.patch
target/linux/mediatek/patches-6.12/741-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch

diff --git a/target/linux/generic/backport-6.12/603-v6.14-net-pcs-pcs-mtk-lynxi-correctly-report-in-band-statu.patch b/target/linux/generic/backport-6.12/603-v6.14-net-pcs-pcs-mtk-lynxi-correctly-report-in-band-statu.patch
new file mode 100644 (file)
index 0000000..d34bc8e
--- /dev/null
@@ -0,0 +1,33 @@
+From a003c38d9bbbacd26b2354795bddb8d25631b0b5 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel@makrotopia.org>
+Date: Thu, 2 Jan 2025 12:41:21 +0000
+Subject: net: pcs: pcs-mtk-lynxi: correctly report in-band status capabilities
+
+Neither does the LynxI PCS support QSGMII, nor is in-band-status supported
+in 2500Base-X mode. Fix the pcs_inband_caps() method accordingly.
+
+Fixes: 520d29bdda86 ("net: pcs: pcs-mtk-lynxi: implement pcs_inband_caps() method")
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+Link: https://patch.msgid.link/Z3aJccb1vW14aukg@pidgin.makrotopia.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/pcs/pcs-mtk-lynxi.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/pcs/pcs-mtk-lynxi.c
++++ b/drivers/net/pcs/pcs-mtk-lynxi.c
+@@ -93,11 +93,12 @@ static unsigned int mtk_pcs_lynxi_inband
+ {
+       switch (interface) {
+       case PHY_INTERFACE_MODE_1000BASEX:
+-      case PHY_INTERFACE_MODE_2500BASEX:
+       case PHY_INTERFACE_MODE_SGMII:
+-      case PHY_INTERFACE_MODE_QSGMII:
+               return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE;
++      case PHY_INTERFACE_MODE_2500BASEX:
++              return LINK_INBAND_DISABLE;
++
+       default:
+               return 0;
+       }
index bf26a2f6ec1ccaac1242c0221b876737e0ae39c1..2073f40d8982719262f054e75e17af782a6b5d66 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
 
 --- a/drivers/net/pcs/pcs-mtk-lynxi.c
 +++ b/drivers/net/pcs/pcs-mtk-lynxi.c
-@@ -129,14 +129,23 @@ static void mtk_pcs_lynxi_get_state(stru
+@@ -130,14 +130,23 @@ static void mtk_pcs_lynxi_get_state(stru
                                    struct phylink_link_state *state)
  {
        struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
@@ -41,7 +41,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  }
  
  static void mtk_sgmii_reset(struct mtk_pcs_lynxi *mpcs)
-@@ -157,7 +166,7 @@ static int mtk_pcs_lynxi_config(struct p
+@@ -158,7 +167,7 @@ static int mtk_pcs_lynxi_config(struct p
  {
        struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
        bool mode_changed = false, changed;
@@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
        int advertise, link_timer;
  
        advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
-@@ -180,9 +189,8 @@ static int mtk_pcs_lynxi_config(struct p
+@@ -181,9 +190,8 @@ static int mtk_pcs_lynxi_config(struct p
        if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
                if (interface == PHY_INTERFACE_MODE_SGMII)
                        sgm_mode |= SGMII_SPEED_DUPLEX_AN;
index 0e4a63ec7fbe960dbbdcacb56713038447a09ae0..4b16fd2956dbf1029dff4cae3ed980625a885357 100644 (file)
@@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  static struct mtk_pcs_lynxi *pcs_to_mtk_pcs_lynxi(struct phylink_pcs *pcs)
  {
        return container_of(pcs, struct mtk_pcs_lynxi, pcs);
-@@ -117,6 +139,17 @@ static void mtk_pcs_lynxi_get_state(stru
+@@ -118,6 +140,17 @@ static void mtk_pcs_lynxi_get_state(stru
                                         FIELD_GET(SGMII_LPA, adv));
  }
  
@@ -97,7 +97,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  static int mtk_pcs_lynxi_config(struct phylink_pcs *pcs, unsigned int neg_mode,
                                phy_interface_t interface,
                                const unsigned long *advertising,
-@@ -162,6 +195,7 @@ static int mtk_pcs_lynxi_config(struct p
+@@ -163,6 +196,7 @@ static int mtk_pcs_lynxi_config(struct p
                                SGMII_PHYA_PWD);
  
                /* Reset SGMII PCS state */
@@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
                regmap_set_bits(mpcs->regmap, SGMSYS_RESERVED_0,
                                SGMII_SW_RESET);
  
-@@ -248,10 +282,29 @@ static void mtk_pcs_lynxi_link_up(struct
+@@ -249,10 +283,29 @@ static void mtk_pcs_lynxi_link_up(struct
        }
  }
  
@@ -135,7 +135,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
        mpcs->interface = PHY_INTERFACE_MODE_NA;
  }
  
-@@ -262,11 +315,12 @@ static const struct phylink_pcs_ops mtk_
+@@ -263,11 +316,12 @@ static const struct phylink_pcs_ops mtk_
        .pcs_an_restart = mtk_pcs_lynxi_restart_an,
        .pcs_link_up = mtk_pcs_lynxi_link_up,
        .pcs_disable = mtk_pcs_lynxi_disable,
@@ -151,7 +151,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  {
        struct mtk_pcs_lynxi *mpcs;
        u32 id, ver;
-@@ -274,29 +328,33 @@ struct phylink_pcs *mtk_pcs_lynxi_create
+@@ -275,29 +329,33 @@ struct phylink_pcs *mtk_pcs_lynxi_create
  
        ret = regmap_read(regmap, SGMSYS_PCS_DEVICE_ID, &id);
        if (ret < 0)
@@ -192,7 +192,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  
        mpcs->ana_rgc3 = ana_rgc3;
        mpcs->regmap = regmap;
-@@ -307,6 +365,13 @@ struct phylink_pcs *mtk_pcs_lynxi_create
+@@ -308,6 +366,13 @@ struct phylink_pcs *mtk_pcs_lynxi_create
        mpcs->interface = PHY_INTERFACE_MODE_NA;
  
        return &mpcs->pcs;
@@ -206,7 +206,7 @@ Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  }
  EXPORT_SYMBOL(mtk_pcs_lynxi_create);
  
-@@ -319,5 +384,142 @@ void mtk_pcs_lynxi_destroy(struct phylin
+@@ -320,5 +385,142 @@ void mtk_pcs_lynxi_destroy(struct phylin
  }
  EXPORT_SYMBOL(mtk_pcs_lynxi_destroy);
  
index d4d09b64fdb7463de96c8f2d7e62ee3217715c4c..d72b9fb7dcc92dbe4e34cededdca70c67a659ff1 100644 (file)
@@ -10,7 +10,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
 
 --- a/drivers/net/pcs/pcs-mtk-lynxi.c
 +++ b/drivers/net/pcs/pcs-mtk-lynxi.c
-@@ -413,9 +413,12 @@ static int mtk_pcs_lynxi_probe(struct pl
+@@ -414,9 +414,12 @@ static int mtk_pcs_lynxi_probe(struct pl
        if (of_property_read_bool(np->parent, "mediatek,pnswap"))
                flags |= MTK_SGMII_FLAG_PN_SWAP;
  
@@ -26,7 +26,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
  
        reset_control_deassert(mpcs->rstc);
        mpcs->sgmii_sel = devm_clk_get_enabled(dev, "sgmii_sel");
-@@ -462,6 +465,7 @@ static void mtk_pcs_lynxi_remove(struct
+@@ -463,6 +466,7 @@ static void mtk_pcs_lynxi_remove(struct
  }
  
  static const struct of_device_id mtk_pcs_lynxi_of_match[] = {
index eef6e361a95413abb7a359249627802bb6b416c7..fd0a587bb02b0b677b0ea4734466d4ec25b61cab 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
  
  /* Register to reset SGMII design */
  #define SGMSYS_RESERVED_0             0x34
-@@ -166,7 +169,7 @@ static int mtk_pcs_lynxi_config(struct p
+@@ -167,7 +170,7 @@ static int mtk_pcs_lynxi_config(struct p
  {
        struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs);
        bool mode_changed = false, changed;
@@ -37,7 +37,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
        int advertise, link_timer;
  
        advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
-@@ -193,6 +196,12 @@ static int mtk_pcs_lynxi_config(struct p
+@@ -194,6 +197,12 @@ static int mtk_pcs_lynxi_config(struct p
                        bmcr = BMCR_ANENABLE;
        }
  
@@ -50,7 +50,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
        if (mpcs->interface != interface) {
                link_timer = phylink_get_link_timer_ns(interface);
                if (link_timer < 0)
-@@ -235,12 +244,14 @@ static int mtk_pcs_lynxi_config(struct p
+@@ -236,12 +245,14 @@ static int mtk_pcs_lynxi_config(struct p
  
        /* Update the sgmsys mode register */
        regmap_update_bits(mpcs->regmap, SGMSYS_SGMII_MODE,
@@ -67,7 +67,7 @@ Signed-off-by: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
  
        /* Release PHYA power down state
         * Only removing bit SGMII_PHYA_PWD isn't enough.
-@@ -413,6 +424,9 @@ static int mtk_pcs_lynxi_probe(struct pl
+@@ -414,6 +425,9 @@ static int mtk_pcs_lynxi_probe(struct pl
        if (of_property_read_bool(np->parent, "mediatek,pnswap"))
                flags |= MTK_SGMII_FLAG_PN_SWAP;